body {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1em;
  font-weight: 400;
  overflow: hidden;
}

@import "variables.less";

@headerHeight: 126px; /* bumped up from 60px due to Glitch banner */
@toolbarHeight: 60px;
@brambleTop: 180px; /* bumped up from 120px due to Glitch banner */

/* Transition time for hover effects */
@transitionTime: 0.15s;

#webmaker-bramble {
  position: absolute;
  display: block;
  top: @brambleTop;
  left: 0;
  width: 100%;
  bottom: 0;
  border: 0;
  background-color: #f8f8f8;
}

// Logo position overrides
.navbar-thimble {
  background: #2d9961;
  position: relative;

  .navbar-logo-container.small-logo {
    top: 2px;
    left: -9px;
  }
}

.bramble-toolbar {
  position: absolute;
  z-index: 2;
  top: @headerHeight;
  height: @toolbarHeight;
  width: 100%;
  margin: 0;
  padding: 0;
  background: #eaeaea;
}

.has-alert-bar .bramble-toolbar {
  top: 100px;
}

.editor-nav {
  position: absolute;
  display: block;
  top: 0;
  width: 100%;
  height: 0;
}

// For capturing mouse events over the iframe when menus appear overtop.
.click-underlay {
  width: 100%;
  min-height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 150;
  overflow: hidden;
}

/* ------ FILETREE PANE ------ */
.filetree-pane-nav {
  top: 0;
  left: 0;
  z-index: 2;
  height: @toolbarHeight;
  background-color: #212121;
  vertical-align: top;
  float: left;
  overflow: hidden;

  .narrow {
    display: none;
  }
}

.filetree-pane-nav-title {
  color: white;
  font-weight: 600;
  font-size: 1em;
  opacity: 0.45;
  filter: alpha(opacity=45);
  .vertical-align;
}

.filetree-pane-nav-btn {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 10px;
}

#filetree-pane-nav-add {
  width: 25px;
  height: 25px;
  background-color: @buttonGreen;
  margin-right: 5px;
  border-radius: 1px;
  .icon;
  .transition;

  div {
    background-image: url("/img/icon/file-white.svg");
    background-size: 13px 15px;
  }

  &:hover {
    background-color: @buttonGreenHover;
  }

  &:active {
    background-color: @buttonGreenActive;
  }
}

#filetree-pane-nav-hide {
  width: 25px;
  height: 25px;
  background-color: #3f3f3f;
  border-radius: 1px;
  .icon;
  .transition;

  div {
    background-image: url("/img/icon/file-tray-arrow-left.svg");
    opacity: 0.4;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
  }

  &:hover {
    background-color: #4f4f4f;
  }

  &:active {
    div {
      opacity: 0.7;
    }

    background-color: #4f4f4f;
  }
}

#filetree-pane-nav-add-menu {
  position: absolute;
  z-index: 151;
  background: white;
  min-width: 200px;
  top: 65px;
  .menu-shadow;

  ul {
    list-style-type: none;
    margin: 0;
    padding: 0;

    li {
      padding: 12px 14px;
      color: rgba(0, 0, 0, 0.6);

      &.hide {
        display: none;
      }

      &:hover {
        background-color: rgba(0, 0, 0, 0.05);
      }

      .icon;
    }

    .top-border {
      border-top: 1px solid #e5e5e5;
    }
  }
}

/* ------ LEFT PANE ------ */
.editor-pane-nav {
  top: 0;
  width: 50%;
  z-index: 2;
  height: @toolbarHeight;
  background-color: #3f3f3f;
  color: #757575;
  float: left;
  overflow: hidden;

  .nav-container {
    white-space: nowrap;
  }

  .editor-pane-nav-title {
    color: white;
    font-weight: 600;
    opacity: 0.45;
    filter: alpha(opacity=45);
    margin-right: 10px;
    .vertical-align;
  }

  #editor-pane-nav-filename {
    margin-right: 10px;
    font-weight: 600;
  }
}

#editor-pane-nav-fileview {
  width: 25px;
  height: 25px;
  margin-right: 10px;
  background-color: #2b2b2b;
  border-radius: 2px;
  .icon;

  div {
    width: 100%;
    height: 100%;
    background-image: url("/img/icon/file-tray-arrow-right.svg");
    opacity: 0.2;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
    .transition;
  }

  &:hover div {
    opacity: 0.4;
  }

  &:active {
    background-color: #1b1b1b;
  }
}

#editor-pane-nav-undo {
  background-color: #2b2b2b;
  border-radius: 25px;
  height: 20px;
  padding: 5px 8px 5px 7px;
  position: relative;

  .icon;

  img {
    opacity: 0.5;
    filter: alpha(opacity=50);
    height: 15px;
    width: 15px;
    position: relative;
    top: 0;
    .transition;
  }

  span {
    color: white;
    vertical-align: top;
    position: relative;
    top: -1px;
    opacity: 0.5;
    filter: alpha(opacity=50);
    .transition;
  }

  &:hover {
    img {
      opacity: 0.7;
      filter: alpha(opacity=70);
    }

    span {
      opacity: 0.7;
      filter: alpha(opacity=70);
    }
  }

  &:active {
    background-color: #1b1b1b;

    img {
      opacity: 0.8;
    }

    span {
      opacity: 0.8;
      filter: alpha(opacity=80);
    }
  }
}

#editor-pane-nav-redo {
  background-color: #2b2b2b;
  height: 20px;
  width: 20px;
  padding: 5px;
  border-radius: 50%;
  margin-left: 6px;
  position: relative;
  .icon;

  img {
    opacity: 0.5;
    filter: alpha(opacity=50);
    height: 15px;
    width: 15px;
    position: absolute;
    top: 7px;
    left: 8px;
    .transition;
  }

  &:hover {
    img {
      opacity: 0.7;
      filter: alpha(opacity=70);
    }
  }

  &:active {
    img {
      opacity: 0.8;
    }

    background-color: #1b1b1b;
  }
}

/* Snippets */
#editor-pane-nav-snippets {
  background-color: #2b2b2b;
  height: 30px;
  width: 30px;
  text-align: center;
  border-radius: 50%;
  margin-left: 6px;
  position: relative;
  .icon;

  img {
    opacity: 0.5;
    height: 20px;
    width: 20px;
    position: absolute;
    top: 5px;
    left: 5px;
  }

  &:hover img {
    opacity: 0.7;
  }
}

/* ------ EDITOR SNIPPETS MENU - START ------ */
.snippets-menu-container {
  position: absolute;
  z-index: 151;
  background-color: white;
  min-width: 450px;
  width: 600px;
  top: 65px;
  .menu-shadow;

  .snippets-menu {
    display: flex;
    flex-direction: column;
    max-height: ~"calc(100vh - 175px)";

    header {
      padding: 10px 15px;
      border-bottom: solid 1px rgba(0, 0, 0, 0.15);
      position: relative;

      .snippets-menu-title {
        font-size: 1em;
        font-weight: 600;
        color: black;
        margin: 0;
        float: left;
        padding: 4px 0;
      }

      .snippets-categories {
        position: absolute;
        top: 9px;
        right: 10px;

        span {
          display: inline-block;
          padding: 6px 12px;
          border-radius: 2px;
          text-decoration: none;
          cursor: pointer;
          font-weight: 600;
          font-size: 0.85em;
          color: rgba(0, 0, 0, 0.7);

          &:hover {
            background: rgba(0, 0, 0, 0.06);
            color: rgba(0, 0, 0, 1);
          }

          &.active {
            background: rgba(0, 0, 0, 0.12);
            color: rgba(0, 0, 0, 1);
          }
        }
      }
    }

    .snippets {
      display: flex;
      min-height: 40vh;

      .snippets-list {
        overflow: auto;
        margin: 0;
        padding: 0;
        list-style-type: none;
        width: 220px;
        min-width: 220px;
        max-width: 220px;

        li {
          padding: 12px 30px 12px 15px;
          white-space: normal;
          color: rgba(0, 0, 0, 0.6);

          &.hide {
            display: none;
          }

          &:hover {
            background-color: rgba(0, 0, 0, 0.05);
          }

          &.selected {
            background-color: rgba(0, 0, 0, 0.1);
          }

          .icon;
        }

        .top-border {
          border-top: 1px solid #e5e5e5;
        }
      }

      .snippets-preview-pane {
        background: rgba(0, 0, 0, 0.1);
        padding: 12px 15px 15px;
        border-left: solid 1px rgba(0, 0, 0, 0.15);
        flex-grow: 1;
        overflow: auto;

        pre {
          margin: 0 0 15px;
          font-family: Consolas, Inconsolata, 'Lucida Console', Courier, monospace, fixed;
          line-height: 140%;
          overflow: inherit;
        }

        button {
          .greenButton;
        }

        &.hide {
          display: none;
        }
      }
    }
  }
}

/* ------ EDITOR SNIPPETS MENU - END ------ */

#editor-pane-nav-options.active,
#editor-pane-nav-options:hover {
  opacity: 0.7;
  filter: alpha(opacity=70);
}

#editor-pane-nav-options {
  opacity: 0.5;
  filter: alpha(opacity=50);
  padding: 4px;
  .transition;

  margin-left: 6px;

  .icon;

  img {
    width: 22px;
    display: block;
  }
}

#editor-pane-nav-options:hover {
  opacity: 0.7;
  filter: alpha(opacity=70);
}

/* ------ EDITOR OPTIONS MENU ------ */
#editor-pane-nav-options-menu {
  position: absolute;
  z-index: 151;
  background-color: white;
  -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.24);
  -moz-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.24);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.24);
  top: 65px;
  border-radius: 1px;

  ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    max-height: calc(~"100vh - 150px");

    li {
      padding: 20px 100px 20px 20px;
      position: relative;
      color: rgba(0, 0, 0, 0.6);
      cursor: pointer;
    }

    #editor-option-textsize {
      cursor: default;
    }

    li + li {
      border-top: 1px solid #e5e5e5;
    }
  }
}

.arrow-tip {
  position: absolute;
  border-style: solid;
  border-width: 0 15px 15px;
  border-color: #fff transparent;
  display: block;
  width: 0;
  z-index: 1;
  top: -14px;
  left: calc(~"50% - 11px");
}

// Line wrap toggle
#editor-pane-nav-options-menu {
  .switch-toggle {
    position: absolute;
    right: 18px;
    height: 30px;
    width: 60px;
    top: 16px;

    &.switch-enabled {
      .toggle-backing {
        background: @buttonGreen;
        opacity: 0.3;
      }

      .toggle-button {
        background: @buttonGreen;
        left: 30px;
        .transition;
      }

      &:hover {
        .toggle-button {
          background: @buttonGreenHover;
        }
      }

      &:active {
        .toggle-button {
          background: @buttonGreenActive;
        }
      }
    }

    .toggle-button {
      height: 30px;
      width: 30px;
      background: #7c7c7c;
      position: absolute;
      border-radius: 15px;
      top: 0;
      left: 0;
      transition: left 0.1s ease-out;
    }

    .toggle-backing {
      height: 16px;
      position: absolute;
      top: 7px;
      background: #c6c6c6;
      border-radius: 8px;
      width: 40px;
      left: 10px;
    }

    &:hover {
      .toggle-button {
        background: #8c8c8c;
      }
    }

    &:active {
      .toggle-button {
        background: #6d6d6d;
      }
    }
  }
}

/* Font increase/decrease */
.text-size-ui {
  position: absolute;
  right: 18px;
  top: 16px;

  #editor-pane-nav-decrease-font {
    background-image: url("/img/icon/minus-white.svg");
  }

  #editor-pane-nav-increase-font {
    background-image: url("/img/icon/plus-white.svg");
  }

  .font-size-button {
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
    background-color: @buttonGreen;
    height: 10px;
    width: 10px;
    padding: 10px;
    border-radius: 50%;
    color: white;
    font-size: 1.2em;
    display: inline-block;
    .icon;
    .transition;

    &:hover {
      background-color: @buttonGreenHover;
    }

    &:active {
      background-color: @buttonGreenActive;
    }
  }
}

/* Theme toggle*/
#editor-pane-nav-toggle-theme {
  margin-left: auto;
  background-color: #55986c;
  border-radius: 25px;
  height: 20px;
  padding: 7px 6px 5px 14px;
  width: 45px;
  cursor: pointer;
  position: absolute;
  top: 16px;
  right: 18px;

  div#theme-dark {
    z-index: 11;
    position: absolute;
    height: 28px;
    width: 28px;
    top: 2px;
    left: 2px;

    img {
      position: absolute;
      top: 7px;
      left: 7px;
    }
  }

  div#theme-light {
    z-index: 11;
    position: absolute;
    height: 28px;
    width: 28px;
    right: 2px;
    top: 2px;

    img {
      position: absolute;
      top: 5px;
      left: 5px;
    }
  }

  div#theme-active {
    border-radius: 50%;
    background-color: white;
    width: 28px;
    height: 28px;
    position: absolute;
    z-index: 10;
    top: 2px;
    left: 2px;
  }
}

/* ------ RIGHT PANE ------ */
.preview-tutorial-toggle {
  .preview-pane-nav-title {
    padding-bottom: 1px;
    margin-right: 5px;
    font-weight: bold;
  }

  &.has-toggle {
    .preview-pane-nav-title {
      cursor: pointer;
    }

    .preview-pane-nav-title:hover {
      border-bottom: solid 2px rgba(0, 0, 0, 0.2);
    }

    .preview-title-highlighted {
      color: rgba(0, 0, 0, 0.5);
      border-bottom: solid 2px rgba(0, 0, 0, 0.5);

      &:hover {
        border-bottom: solid 2px rgba(0, 0, 0, 0.5);
      }
    }
  }
}

.refresh-wrapper {
  position: relative;
  vertical-align: middle;

  #preview-pane-nav-refresh {
    z-index: 2;
    display: inline-block;
    vertical-align: middle;
    position: relative;
    background-color: #f9f9f9;
    height: 20px;
    width: 20px;
    padding: 5px;
    border-radius: 50%;
    border: solid 2px #eaeaea;

    &.spin img {
      animation: spin 0.25s ease-out;
    }

    img {
      opacity: 0.3;
      filter: alpha(opacity=30);
      height: 22px;
      width: 22px;
      position: relative;
      top: -1px;
      left: -1px;
      .transition;
    }
    .icon;

    &:hover {
      img {
        opacity: 0.6;
        filter: alpha(opacity=60);
      }
    }
  }

  .toggle-auto-update {
    position: relative;
    left: -18px;
    vertical-align: middle;
    z-index: 1;
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    border-radius: 0 12px 12px 0;
    background: #f9f9f9;
    padding: 6px 10px 6px 20px;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;

    &:active {
      color: rgba(0, 0, 0, 0.5);

      .checkbox {
        border: solid 1px rgba(0, 0, 0, 0.4);
        background: #eee;
      }
    }

    &:hover {
      color: rgba(0, 0, 0, 0.6);
    }

    .checkbox {
      position: relative;
      width: 14px;
      height: 14px;
      border-radius: 2px;
      box-sizing: border-box;
      display: inline-block;
      background: white;
      border: solid 1px rgba(0, 0, 0, 0.2);
      vertical-align: middle;
      top: -1px;
      margin-right: 2px;

      img {
        position: absolute;
        width: 10px;
        top: 2px;
        left: 2px;
        display: none;
      }
    }
  }

  &.enabled {
    .toggle-auto-update {
      color: rgba(0, 0, 0, 0.6);

      .checkbox {
        background: #269a5f;
        border: none;

        img {
          display: block;
          animation: checkPop 0.15s ease-out;
        }
      }
    }
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(359deg); }
}

@keyframes checkPop {
  0% { transform: scale(0.7); }
  100% { transform: scale(1); }
}

.preview-pane-nav {
  top: 0;
  position: absolute;
  height: @toolbarHeight;
  z-index: 2;
  background-color: #eaeaea;
  float: right;
  overflow: hidden;

  .flex-container;

  .nav-container {
    white-space: nowrap;
  }
}

.preview-pane-nav-title {
  color: #a9a9a9;
  font-weight: bold;
  font-size: 1em;
}

#preview-pane-nav-inspector {
  background-color: #f9f9f9;
  height: 20px;
  width: 20px;
  padding: 5px;
  border-radius: 50%;
  position: relative;
  margin-left: 6px;

  .icon-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: ~"url(/img/icon/inspector-off.svg)";
    background-size: 17px;
    background-position: center 8px;
    background-repeat: no-repeat;
    opacity: 0.3;
    filter: alpha(opacity=30);
    .transition;
  }

  &:hover {
    .icon-wrapper {
      background-image: ~"url(/img/icon/inspector-hover.svg)";
      opacity: 1;
    }
  }

  &.enabled {
    background-color: #2493ba;

    .icon-wrapper {
      background-image: ~"url(/img/icon/inspector-on.svg)";
      opacity: 1;
    }
  }

  .icon;
}

.preview-device-toggle {
  background: #f9f9f9;
  border-radius: 30px;
  height: 30px;
  margin-left: 6px;

  img {
    width: 20px;
    height: 20px;
    position: relative;
    top: 5px;
    .transition;
  }
}

#preview-pane-nav-desktop {
  .icon;

  margin-left: 13px;
}

#preview-pane-nav-desktop:hover {
  .viewmode-active;
}

#preview-pane-nav-phone {
  .icon;

  margin: 0 10px 0 4px;
}

#preview-pane-nav-phone:hover {
  .viewmode-active;
}

.viewmode-active {
  opacity: 0.6;
  filter: alpha(opacity=60);
}

.viewmode-inactive {
  opacity: 0.3;
  filter: alpha(opacity=30);
  .transition;
}

.fullscreen-preview-toggle {
  margin-left: 8px;
  line-height: 19px;
  cursor: pointer;

  .disable-fullscreen {
    display: none;
  }

  &:hover {
    img {
      opacity: 0.6;
    }
  }

  img {
    width: 18px;
    height: 18px;
    position: relative;
    opacity: 0.3;
    top: 2px;
    margin: 4px;
    .transition;
  }
}

/* ------ MIXINS ------ */
.pull-right {
  margin-left: auto;
}

.transition {
  -webkit-transition: @transitionTime ease-out;
  -moz-transition: @transitionTime ease-out;
  -ms-transition: @transitionTime ease-out;
  -o-transition: @transitionTime ease-out;
  transition: @transitionTime ease-out;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition-timing-function: ease-out;
}

.icon {
  cursor: pointer;
  -webkit-user-select: none; /* Chrome/Safari */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* IE10+ */
}

.flex-container {
  display: -webkit-inline-flex;
  display: -ms-inline-flexbox;
  display: inline-flex;
  min-height: 1px;
}

.nav-container {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding-right: 20px;
  padding-left: 20px;
  white-space: nowrap;

  .narrow {
    display: none;
  }

  .flex-vertical-align;
}

.flex-vertical-align {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.vertical-align {
  margin-top: auto;
  margin-bottom: auto;
}

.hide {
  display: none;
}

.top-alert-bar {
  background: #176db3;
  text-align: center;
  font-size: 15px;
  padding: 7px 15px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  strong {
    font-weight: 600;
    color: white;
  }

  button {
    outline: none;
    border: none;
    border-radius: 1px;
    color: #176db3;
    background: white;
    padding: 3px 8px;
    margin-left: 15px;

    &:hover {
      opacity: 0.8;
    }

    &:active {
      opacity: 1;
    }
  }
}

.has-alert-bar #webmaker-bramble {
  top: 160px;
}

#browser-support-warning {
  position: fixed;
  background: rgba(11, 67, 38, 0.9);
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;

  .message-box {
    border-radius: 2px;
    position: absolute;
    width: 500px;
    background: white;
    color: black;
    padding: 20px;
    box-sizing: border-box;
    left: ~"calc(50% - 250px)";
    top: ~"calc(50% - 150px)";

    h1 {
      margin: 0 0 15px;
      padding: 0;
      font-size: 22px;
    }

    p {
      margin: 0 0 10px;
    }

    a {
      color: #28975a;
      text-decoration: none;
      font-weight: bold;

      &:hover {
        text-decoration: underline;
      }
    }

    .let-me-in {
      display: inline-block;
      padding: 12px 15px 11px;
      background: @buttonGreen;
      color: white;
      font-weight: normal;
      border-radius: 2px;
      margin-top: 15px;
      text-decoration: none;
      border-bottom: solid 2px rgba(0, 0, 0, 0.1);
      cursor: pointer;

      &:hover {
        background: @buttonGreenHover;
        text-decoration: none;
      }

      &:active {
        background: @buttonGreenActive;
      }
    }
  }
}

.fullscreen-preview {
  #webmaker-bramble {
    top: 0;
  }

  .filetree-pane-nav,
  .editor-pane-nav,
  .nav,
  .toggle-auto-update {
    display: none !important;
  }

  .bramble-toolbar {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 98px;
    height: 52px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    box-sizing: border-box;

    .preview-pane-nav {
      height: 44px;
      position: absolute;
      width: 90px !important;
      top: 4px;
      right: 8px;
      box-sizing: border-box;
      border-radius: 1px;

      .nav-container {
        padding: 0 12px;

        .pull-right {
          margin-left: 0;
        }
      }
    }

    #preview-pane-nav-refresh {
      margin: 0 10px 0 0;
    }

    #preview-pane-nav-inspector {
      display: none;
    }

    .fullscreen-preview-toggle {
      margin-left: 0;

      .enable-fullscreen {
        display: none;
      }

      .disable-fullscreen {
        display: block;
      }
    }

    .preview-tutorial-toggle,
    .preview-device-toggle {
      display: none;
    }
  }
}

body.modal-open .dialog-overlay {
  display: block;
  z-index: 99;
  animation: showModalBackdrop 0.1s ease-out;

  @keyframes showModalBackdrop {
    0% {
      opacity: 0;
    }

    100% {
      opacity: 0.8;
    }
  }
}

.dialog-overlay {
  position: absolute;
  display: none;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
}
